<template>
  <div class="music-player">
    <div class="song-details">
      <img src="https://via.placeholder.com/40/810b14" alt="Current Song" class="song-cover" />
      <div class="song-info">
        <span class="song-title">打PP还流水</span>
        <span class="song-artist">谁在敲打忆水年华</span>
      </div>
    </div>
    <div class="player-controls">
      <button class="control-button shuffle">🔁</button>
      <button class="control-button prev">⏮️</button>
      <button class="control-button play-pause">▶️</button> <!-- Use ▶️ or ⏸️ -->
      <button class="control-button next">⏭️</button>
      <button class="control-button loop">🔂</button>
    </div>
    <div class="progress-section">
      <span class="time current-time">0:00</span>
      <input type="range" class="progress-bar" value="0" min="0" max="100" />
      <span class="time total-time">3:07</span>
    </div>
    <div class="extra-controls">
       <button class="control-button volume">🔊</button>
       <input type="range" class="volume-slider" value="80" min="0" max="100" />
       <button class="control-button lyrics">📄</button>
       <button class="control-button playlist">☰</button>
    </div>
  </div>
</template>

<script>
export default {
  name: 'MusicPlayer',
};
</script>

<style scoped>
.music-player {
  position: fixed;
  bottom: 0;
  left: 0; /* Changed from margin-left to cover full width below sidebar */
  width: 100%; /* Full width */
  height: 80px; /* Adjust height as needed */
  background-color: #181818; /* Slightly lighter than sidebar */
  border-top: 1px solid #282828;
  color: #ccc;
  display: flex;
  align-items: center;
  justify-content: space-between; /* Distribute items */
  padding: 0 20px;
  box-sizing: border-box;
  z-index: 1000; /* Ensure it's above other content */
}

.song-details {
  display: flex;
  align-items: center;
  width: 240px; /* Match sidebar width for alignment */
  flex-shrink: 0; /* Prevent shrinking */
}

.song-cover {
  width: 50px;
  height: 50px;
  border-radius: 4px;
  margin-right: 15px;
}

.song-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.song-title {
  color: #fff;
  font-size: 0.9em;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-artist {
  font-size: 0.8em;
  color: #aaa;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 15px; /* Space between buttons */
  flex-grow: 1; /* Allow controls to take up space */
  justify-content: center; /* Center the main controls */
}

.control-button {
  background: none;
  border: none;
  color: #aaa;
  font-size: 1.4em; /* Adjust icon size */
  cursor: pointer;
  padding: 5px;
  transition: color 0.2s ease;
}

.control-button:hover {
  color: #fff;
}

.play-pause {
  font-size: 2em; /* Larger play/pause button */
  color: #fff;
  background-color: #333; /* Slight background for emphasis */
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1; /* Adjust line height for vertical centering */
}
.play-pause:hover {
    background-color: #444;
}


.progress-section {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 40%; /* Adjust width as needed */
  min-width: 300px; /* Minimum width */
}

.time {
  font-size: 0.8em;
  color: #aaa;
  min-width: 30px; /* Ensure time doesn't jump around */
  text-align: center;
}

.progress-bar {
  flex-grow: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: #444;
  border-radius: 2px;
  cursor: pointer;
}

.progress-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  background: #ccc;
  border-radius: 50%;
  cursor: pointer;
}

.progress-bar::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: #ccc;
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

.extra-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 200px; /* Adjust as needed */
  justify-content: flex-end; /* Align to the right */
}

.volume-slider {
   width: 80px; /* Adjust width */
   height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: #444;
  border-radius: 2px;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  background: #ccc;
  border-radius: 50%;
  cursor: pointer;
}

.volume-slider::-moz-range-thumb {
   width: 10px;
   height: 10px;
   background: #ccc;
   border-radius: 50%;
   cursor: pointer;
   border: none;
}

/* Adjust icon sizes for extra controls if needed */
.extra-controls .control-button {
    font-size: 1.2em;
}

</style>